import request from '@/utils/request'

const reqUser ={
  
    //分页查询，按条件引入
    page:(page,size,user)=>{
        return request.post('/user/page',
        {
            "page":page,
            "size":size,
            "username":user.username,
            "phone":user.phone,
            "email":user.email,
            "nickname":user.nickname,
            "status":user.status,
            "role":user.role
        }).then(res=>{
            return res.data;
        })

    },
      
    //单个删除
    deleteByid:(id)=>{
      return request.delete(`/user/delete/${id}`).then(res=>{
         return res.data;
      })
    },
    //批量删除
    deleteBuch:(ids)=>{
        return request.post('/user/deletebuch',
        {
            ids:ids
        }).then(res=>{
            return res.data;
        })
    },
    //修改用户
    updateUser:(userid,formdata)=>{
        return request.post(`/user/update/${userid}`,formdata,{
            headers:{
                "Content-Type":'multipart/form-data'
            }
        }).then(res=>{
            return res.data;
        })
    },
    //新增用户
    insertUser:(userid,formdata)=>{
        return request.post(`/user/insert/${userid}`,formdata,{
            headers:{
                "Content-Type":'multipart/form-data'
            }
        }).then(res=>{
            return res.data;
        })
    }

 

}



export default reqUser;